<?php

namespace app\api\controller;

use think\Controller;

class Course extends Controller
{
    //日语培训
    public function course()
    {
        $course = model('common/Course')
            -> field('id,cname,score,account,img')
            -> limit(2)
            -> select();
        if ($course){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$course]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }

    //日语培训详情
    public function course_list()
    {
        $course = model('common/Course')
            -> field('cname,details')
            -> select();
        if ($course){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$course]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }
}
